package com.hldsmart.smartda.adapter.home;

import android.content.Context;
import android.os.Handler;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.hldsmart.smartda.R;
import com.hldsmart.smartda.model.entity.ShopFragmentEntity;

import java.util.List;

/**
 * Created by sunxiao on 2017/1/20.
 */

public class ShoplvAdapter extends BaseAdapter{

    Context context;
    List<ShopFragmentEntity> list;

    public ShoplvAdapter(Context context, List<ShopFragmentEntity> list){
        this.context=context;
        this.list=list;

    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public ShopFragmentEntity getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView=View.inflate(context, R.layout.spxlist_item,null);
        TextView name= (TextView) convertView.findViewById(R.id.tv_shoptv);
        TextView label= (TextView) convertView.findViewById(R.id.tv_shoplabel);
        ImageView shopimage= (ImageView) convertView.findViewById(R.id.iv_shopimage);

            name.setText(list.get(position).getName().toString());
            label.setText(list.get(position).getLabel().toString());
        shopimage.setImageResource(list.get(position).getImage());

        return convertView;
    }
}
